module.exports = {
    //byte
    BF: function(v, digits = 1, base = 1024) {
        v = Util.toNum(v, true);
        if (v === 0) {
            return "0B";
        }
        let prefix = "";
        if (v < 0) {
            v = Math.abs(v);
            prefix = "-";
        }
        const units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
        for (let i = 0, l = units.length; i < l; i++) {
            let min = Math.pow(base, i);
            let max = Math.pow(base, i + 1);
            if (v > min && v < max) {
                let unit = units[i];
                v = prefix + (v / min).toFixed(digits) + unit;
                break;
            }
        }
        return v;
    },

    formatPath: function(str) {
        if (str) {
            str = str.replace(/\\/g, "/");
        }
        return str;
    },
};